#
# /*
#  *  Copyright 2021
#  *
#  *  This program is free software: you can redistribute it and/or modify
#  *  it under the terms of the GNU General Public License as published by
#  *  the Free Software Foundation, either version 3 of the License, or
#  *  (at your option) any later version.
#  *
#  *  This program is distributed in the hope that it will be useful,
#  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  *  GNU General Public License for more details.
#  *
#  *  You should have received a copy of the GNU General Public License
#  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
#  *
#  * SPDX-License-Identifier: GPL-3.0+
#  * License-Filename: LICENSE
#  *
#  */
#

esc='s/\\/\\\\/g;s/"/\\"/g'
puts='s/^/puts("/;s/$/");++nr;/'
cmd="$esc;$puts"

echo '#include <stdio.h>'
echo '#include "template.h"'

echo 'void pre_decl(void) {'
sed -e "/EMIT_DECLARATIONS/,\$d;$cmd" pacc.tmpl
echo '}'

echo 'void pre_engine(void) {'
sed -e "1,/EMIT_DECLARATIONS/d;/EMIT_ENGINE/,\$d;$cmd" pacc.tmpl
echo '}'

echo 'void post_engine(void) {'
sed -e "1,/EMIT_ENGINE/d;$cmd" pacc.tmpl
echo '}'

# /* end. */
